<template>
	<view class="flex-column h100 w100">
		<uni-nav-bar :fixed="true" height="80rpx" :statusBar='!isWin' left-icon='left' @clickLeft="gobacks" title="反馈">
		</uni-nav-bar>
		<view style="min-height: 50rpx">
			<u--textarea v-model="content" placeholder="填写你的意见和反馈错误"></u--textarea>
		</view>
		<u-button type="primary" text="发布" @click="release"></u-button>
	</view>
</template>

<script>
	export default {
		name: 'personal-feedback',
		data() {
			return {
				content:'',
			}
		},
		methods: {
			gobacks() {
				wx.showModal({
					title: '是否离开',
					content: '是否要放弃当前内容离开',
					success: (res) => {
						if (res.confirm) {
							wx.navigateBack();
						}
					}
				});
			},
			release(){
				wx.cloud.callFunction({
					name:'quickstartFunctions',
					data:{
						type:'feedback',
						data:{
							user: this.$store.getters.getUser,
							content:this.content,
							time:+new Date()
						}
					},
					success:(res)=>{
						wx.showToast({
							title:'提交成功',
							icon:'success',
							duration:1000,
							success:(res)=>{
								wx.navigateBack()
							}
						})
					},
					fail:(err)=>{
						wx.showToast({
							title:'提交失败',
							icon:'error',
							duration:1000,
						})
					}
				})
			}
		}
	}
</script>

<style>
</style>
